package com.yx.changdao.common.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.liaochong.myexcel.core.annotation.ExcelColumn;
import com.yx.changdao.common.annotation.AutoFill;
import com.yx.changdao.common.utils.SysUtils;
import lombok.Getter;
import lombok.Setter;
import org.nutz.dao.entity.annotation.Table;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;


@TableName(CommunityResident.TABLE_NAME)
@Getter
@Setter
public class CommunityResident implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 数据库名
     */
    public static final String TABLE_NAME = "community_resident";

    /**
     * 人员id
     */
    public static final String ID = "id";
    /**
     * 户id
     */
    public static final String BUILD_DETAIL_ID = "build_detail_id";

    /**
     * 网格id
     */
    public static final String GRID_ID = "grid_id";
    /**
     * 乡镇id
     */
    public static final String TOWN_SHIP_ID = "town_ship_id";


    /**
     * 村/社区id
     */
    public static final String VILLAGE_ID = "village_id";
    /**
     * 网格名
     */
    public static final String GRID_NAME = "grid_name";
    /**
     * 楼名
     */
    public static final String BUILD_NAME = "build_name";
    /**
     * 楼id
     */
    public static final String BUILD_ID = "build_id";
    /**
     * 单元
     */
    public static final String UNIT = "unit";
    public static final String NATIVE_PLACE = "native_place";
    /**
     * 姓名
     */
    public static final String USER_NAME = "user_name";
    /**
     * 性别（0，女，1，男）
     */
    public static final String GENDER = "gender";
    /**
     * 出生年月
     */
    public static final String BIRTH = "birth";
    /**
     * 民族
     */
    public static final String NATION = "nation";
    /**
     * 楼信息
     */
    public static final String BUILDINGINFORMATION = "buildingInformation";
    /**
     * 政治面貌
     */
    public static final String POLITICAL = "political";
    /**
     * 文化程度
     */
    public static final String EDUCATION = "education";
    /**
     * 工作单位
     */
    public static final String OFFICE_COMPANY = "office_company";
    /**
     * 从事职业
     */
    public static final String OFFICE_JOB = "office_job";
    /**
     * 身份证
     */
    public static final String ID_CARD = "id_card";
    /**
     * 电话
     */
    public static final String PHONE = "phone";
    /**
     * 身体状况
     */
    public static final String HEALTH_STATUS = "health_status";
    /**
     * 婚姻状况
     */
    public static final String MARRY_STATUS = "marry_status";
    /**
     * 服兵役情况
     */
    public static final String MILITARY_SERVICE = "military_service";
    /**
     * 是否退休
     */
    public static final String RETIREMENT = "retirement";
    /**
     * 省
     */
    public static final String PROVINCE = "province";
    /**
     * 市
     */
    public static final String CITY = "city";
    /**
     * 区
     */
    public static final String DISTRICT = "district";
    /**
     * 详细信息
     */
    public static final String DETAILED_ADDRESS = "detailed_address";

    /**
     * 年收入情况
     */
    public static final String INCOME = "income";
    /**
     * 与户主的关系（0,亲人，1.租户  2.户主）
     */
    public static final String RELATION = "relation";
    /**
     * 创建时间
     */
    public static final String CREATE_TIME = "create_time";
    /**
     * 创建人
     */
    public static final String CREATE_BY_NAME = "create_by_name";
    /**
     * 创建人id
     */
    public static final String CREATE_BY = "create_by";
    /**
     * 更新时间
     */
    public static final String UPDATE_TIME = "update_time";
    /**
     * 更新人
     */
    public static final String UPDATE_BY_NAME = "update_by_name";
    /**
     * 更新人id
     */
    public static final String UPDATE_BY = "update_by";


    /**
     * 人员id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    @TableField(exist = false)
    @ExcelColumn(index = 0, title = "楼编号")
    private String buildCode;

    /**
     * 单元
     */
    @ExcelColumn(index = 1, title = "单元号/排号")
    private Integer unit;

    @TableField(exist = false)
    @ExcelColumn(index = 2, title = "室号")
    private String doorPlate;

    /**
     * 姓名
     */
    @NotNull(message = "姓名不允许为空")
    @ExcelColumn(index = 3, title = "姓名")
    private String userName;
    /**
     * 性别（0，女，1，男）
     */
    @NotNull(message = "性别不允许为空")
    @ExcelColumn(index = 4, title = "性别", mapping = "0:女,1:男")
    private Integer gender;

    /**
     * 身份证
     */
    @ExcelColumn(index = 5, title = "身份证号")
    private String idCard;
    /**
     * 出生年月
     */
    @ExcelColumn(index = 6, title = "出生年月", format = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date birth;

    /**
     * 民族
     */
    @ExcelColumn(index = 7, title = "民族")
    private String nation;

    /**
     * 文化程度
     */
    @ExcelColumn(index = 8, title = "文化程度")
    private String education;

    /**
     * 政治面貌
     */
    @NotNull(message = "政治面貌不允许为空")
    @ExcelColumn(index = 9, title = "政治面貌")
    private String political;

    /**
     * 从事职业
     */
    @ExcelColumn(index = 10, title = "职业")
    private String officeJob;

    /**
     * 与户主的关系
     */
    @NotNull(message = "与户主关系不能为空")
    @ExcelColumn(index = 11, title = "与户主关系")
    private String relation;
    /**
     * 籍贯
     */
    @ExcelColumn(index = 12, title = "籍贯")
    private String nativePlace;

    /**
     * 年收入情况
     */
    @ExcelColumn(index = 13, title = "年收入情况")
    private String income;



    /**
     * 电话
     */
    @ExcelColumn(index = 14, title = "手机号码")
    private String phone;
    /**
     * 婚姻状况
     */
    @ExcelColumn(index = 15, title = "婚姻状况")
    private String marryStatus;
    /**
     * 身体状况
     */
    @ExcelColumn(index = 16, title = "身体状况")
    private String healthStatus;
    /**
     * 工作单位
     */
    @ExcelColumn(index = 17, title = "工作单位")
    @NotNull(message = "工作单位不允许为空")
    private String officeCompany;

    /**
     * 是否退休
     */
    @ExcelColumn(index = 18, title = "是否退休", mapping = "0:是,1:否")
    private Integer retirement;
    /**
     * 服兵役情况
     */
    @ExcelColumn(index = 19, title = "服兵役情况")
    private String militaryService;
    /**
     * 省
     */
    @ExcelColumn(index = 20, title = "省")
    private String province;
    /**
     * 市
     */
    @ExcelColumn(index = 21, title = "市")
    private String city;
    /**
     * 区
     */
    @ExcelColumn(index = 22, title = "区")
    private String district;
    /**
     * 详细信息
     */
    @ExcelColumn(index = 23, title = "详细信息")
    private String detailedAddress;

    /**
     * 乡镇
     */
    @ExcelColumn(index = 24, title = "乡镇")
    private String township;


    /**
     * 户id
     */
    private Integer buildDetailId;
    private String gridName;
    private String buildName;
    /**
     * 网格id
     */
    private Integer gridId;
    /**
     * 村/社区id
     */
    private Integer villageId;
    /**
     * 乡镇id
     */
    private Integer townShipId;

    /**
     * 楼id
     */
    private Integer buildId;


    /**
     * 楼信息
     */
    private String buildingInformation;


    /**
     * 创建时间
     */
    @AutoFill
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     * 创建人
     */
    @AutoFill(klass = SysUtils.class, method = "currentUserName")
    @TableField(fill = FieldFill.INSERT)
    private String createByName;
    /**
     * 创建人id
     */
    @AutoFill(klass = SysUtils.class, method = "currentUserId")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;
    /**
     * 更新时间
     */
    @AutoFill
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    /**
     * 更新人
     */
    @AutoFill(klass = SysUtils.class, method = "currentUserName")
    @TableField(fill = FieldFill.UPDATE)
    private String updateByName;
    /**
     * 更新人id
     */
    @AutoFill(klass = SysUtils.class, method = "currentUserId")
    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

    /**
     * 临时字段
     */
    //性别
    @TableField(exist = false)
    private String genderContent;
    //与户主关系
    @TableField(exist = false)
    private String relationContent;

    //省市区码 英文逗号隔开
    private String location;
    //给前端的数组码
    @TableField(exist = false)
    private List locations;

}
